package hbot;

import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.ml.CvSVM;

public class SVMClassificator {

	CvSVM m_Classificator;
	
	public SVMClassificator(){
		m_Classificator = new CvSVM();
		m_Classificator.load("svm/svm_region_model.xml");
	}
	
	public Float classifyRegion(Mat region){
		Mat out = new Mat();
		region.convertTo(out, CvType.CV_32FC1); 
		float prediction = m_Classificator.predict(out.reshape(1, 1));
		return prediction;
	}
}
